package com.study.sbsummary.config;

import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Configuration
@Setter
@Getter
@ConfigurationProperties(prefix = "plog")
public class HostProperties {
    private String cppArticleStorage;
    private String cppDeleteArticle;
    private String cppRecoverArticle;
    private final Cpp cpp = new Cpp();
    private String prefixPublishDocKey;
    private String messageUrl;

    //只有前缀，但是不带冒号,正文缓存, mongo数据
    private String prefixDocVerVersion1;

    //只有前缀，但是不带冒号
    private String prefixDocVerFiveVersion1;

    private String dingUrl;

    //啫喱正文缓存, mysql+mongo 聚合数据，PREFIX_ZHELI_DOC_DETAIL = "loc_zheli_doc_detail:";
    private String prefixZheliDocDetail;

    private String prefixZheliCollectionInfo;

    private String prefixUserFriendFeedReadStatus;

    //用户好友流已读最大ID,String PREFIX_USER_FRIEND_FEED_MAX_READ_ID = "local_user_friend_feed_max_read_id:";
    private String prefixUserFriendFeedMaxReadId;

    private String prefixUserZlSortInfo;

    //用户好友流缓存表
    private String prefixUserFriendFeed;

    private String prefixZheliUserFriends;

    @Data
    public static class Cpp {
        private final CppConfiguration duanneirong = new CppConfiguration();
        private final CppConfiguration dnr_collection = new CppConfiguration();
        private final CppConfiguration video = new CppConfiguration();
        private final DocInfo docInfo = new DocInfo();
        private final ExtendInfo extendInfo = new ExtendInfo();
    }

    @Data
    public static class CppConfiguration {
        private String url;
        private String token;
        private String type;
    }

    @Setter
    @Getter
    public static class DocInfo {
        private String dsource;
        private String from;
    }

    @Setter
    @Getter
    public static class ExtendInfo {
        private String callback;
    }

    public String getMaxReadIdKey(String uId) {
        return prefixUserFriendFeedMaxReadId + uId;
    }

    public String getFriendFeedReadStatus(String uId) {
        return prefixUserFriendFeedReadStatus + uId;
    }

    //带有冒号的前缀
    public String getPrefixDocVerV1() {
        return prefixDocVerVersion1 + ":";
    }
}
